newString = string.replace(/\s+/g,' ').trim();
const sentence = ' My string with a lot of Whitespace. '.replace(/\s+/g, ' ').trim() // 'My string with a lot of Whitespace.'